﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
   Async="true"  CodeFile="change-password.aspx.cs" Inherits="user_change_password" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpHeader" runat="Server">
    <div class="main-bg">
        <div class="radius-box">
            <div class="general-col-left">
                <div class="main-title-heading">
                    <%=GetGlobalResourceObject("General", "ChangePassword")%></div>
                <div style="width: 450px;">
                    <asp:Label ID="lblMessage" ForeColor="Red" runat="server"></asp:Label>
                    <asp:ValidationSummary ID="vsCustomer" runat="server" ValidationGroup="customer"
                        ShowSummary="True" HeaderText="<%$ Resources:General,RequiredValidation%>" CssClass="error-msg" />
                </div>
                <div class="form-column" style="width:130px;">
                    <span style="color: #FF0004">*</span><%=GetGlobalResourceObject("General", "CurrentPassword")%></div>
                <div class="form-row" style="width:340px;">
                    <asp:TextBox ID="txtOldPassword" runat="server" TextMode="Password" MaxLength="20"
                        CssClass="input-fields"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfvOldPassword" runat="server" ControlToValidate="txtOldPassword"
                        Display="Dynamic" ErrorMessage="" Text="" ValidationGroup="customer" CssClass="validationError"></asp:RequiredFieldValidator>
                </div>
                <div class="form-column" style="width:130px;">
                    <span style="color: #FF0004">*</span><%=GetGlobalResourceObject("General", "NewPassword")%></div>
                <div class="form-row" style="width:340px;">
                    <asp:TextBox ID="txtNewPassword" TextMode="Password" runat="server" MaxLength="20"
                        CssClass="input-fields"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfvNewPassword" runat="server" ControlToValidate="txtNewPassword"
                        CssClass="validationError" Display="Dynamic" ErrorMessage="" Text="" ValidationGroup="customer"></asp:RequiredFieldValidator>
                </div>
                <div class="form-column" style="width:130px;">
                    <span style="color: #FF0004">*</span><%=GetGlobalResourceObject("General", "ConfirmPassword")%></div>
                <div class="form-row" style="width:340px;">
                    <asp:TextBox ID="txtConfirmPassword" TextMode="Password" runat="server" MaxLength="20"
                        CssClass="input-fields"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfvConfirmPassword" runat="server" ControlToValidate="txtConfirmPassword"
                        Display="Dynamic" ErrorMessage="" Text="" ValidationGroup="customer" CssClass="validationError"></asp:RequiredFieldValidator>
                    <asp:CompareValidator ID="csvConfirmPassword" runat="server" ControlToCompare="txtNewPassword"
                        ControlToValidate="txtConfirmPassword" Display="Dynamic" ErrorMessage="" Text=""
                        ValidationGroup="customer" CssClass="validationError"></asp:CompareValidator>
                </div>
                <div class="form-column" style="width:130px;">
                    <%=GetGlobalResourceObject("General", "SecurityCheck")%></div>
                <div class="form-row" style="width:340px;">
                    <asp:UpdatePanel runat="server" ID="uplCAPCHA">
                        <ContentTemplate>
                            <div style="display: block; float: left;">
                                <asp:Image ID="imgCAPTCHA" runat="server" AlternateText="captcha" />
                            </div>
                            <asp:ImageButton ID="btnNewImage" runat="server" OnClick="btnNewImage_Click" ImageUrl="/images/refresh.png"
                                ToolTip="Reload" AlternateText="Refresh" Width="50px" />
                        </ContentTemplate>
                    </asp:UpdatePanel>
                    <asp:UpdateProgress AssociatedUpdatePanelID="uplCAPCHA" DisplayAfter="100" runat="server"
                        ID="udpCAPTCHA">
                        <ProgressTemplate>
                            <%--<asp:Image ID="imgLoading" ImageUrl="/images/refresh.png" runat="server" AlternateText="loading" />--%>
                        </ProgressTemplate>
                    </asp:UpdateProgress>
                </div>
                <div class="form-column" style="width:130px;">
                    <span style="color: #FF0004">*</span><%=GetGlobalResourceObject("General", "TextinBox")%></div>
                <div class="form-row" style="width:340px;">
                    <asp:UpdatePanel ID="uplSecurityCode" runat="server">
                        <ContentTemplate>
                            <span class="indicator">
                                <asp:TextBox ID="txtSecurityCode" CssClass="input-fields" MaxLength="20" runat="server"></asp:TextBox>
                            </span><span class="indicator">
                                <asp:RequiredFieldValidator ID="rfvSecurityCheck" runat="server" ControlToValidate="txtSecurityCode"
                                    CssClass="validationError" Display="Dynamic" ErrorMessage="" Text="" ValidationGroup="customer"></asp:RequiredFieldValidator>
                            </span>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </div>
                <div class="form-row-full" style="width:450px;">
                    <asp:Button ID="btnSubmit" ValidationGroup="customer" Text="<%$ Resources:General,ChangePassword%>"
                        runat="server" CssClass="action-button" OnClick="btnSubmit_Click" ToolTip="<%$ Resources:General,ChangePassword%>"
                        OnClientClick="LoadValidationErrorCss();if (Page_ClientValidate('customer')){this.removeAttribute('onmouseout');this.removeAttribute('onmouseup');this.className = 'action-button-processing';}" /><br />
                    <br />
                </div>
            </div>
            <div class="general-col-right top20">
                <img src="/images/logo-chac.jpg" width="350"
                    height="388" alt="" /></div>
        </div>
    </div>

    <script type="text/javascript">
        function CheckPasswordLength(source, arguments) {
            //var corglen = arguments.Value;
            var cval = arguments.Value;
            var bValid = true;
            var chList = new Array(20);
            var ctrlsource = document.getElementById(source.id);

            //alert("ORG LEN : " + corglen.length + " AFTER : " + cval.length);
            if (cval.indexOf(' ') != -1 || cval.indexOf('\'') != -1
                        || cval.indexOf('\"') != -1 || cval.indexOf('~') != -1) {
                if (ctrlsource.textContent) {
                    ctrlsource.textContent = "Password include invalid character or space!";
                }
                else {
                    ctrlsource.innerText = "Password include invalid character or space!";
                }

                ctrlsource.errormessage = "Password include invalid character or space!";
                bValid = false;
            }
            else if (cval.length < 6) {
                //ctrlsource.innerText = "Password length should be at least 6";
                if (ctrlsource.textContent) {
                    ctrlsource.textContent = "Password length should be at least 6";
                }
                else {
                    ctrlsource.innerText = "Password length should be at least 6";
                }

                ctrlsource.errormessage = "Password length should be at least 6";
                bValid = false;
            }
            else if (cval.length > 20) {
                bValid = false;
                //ctrlsource.innerText = "Password length should not be over 20!";
                if (ctrlsource.textContent) {
                    ctrlsource.textContent = "Password length should not be over 20!";
                }
                else {
                    ctrlsource.innerText = "Password length should not be over 20!";
                }
                ctrlsource.errormessage = "Password length should not be over 20!";
            }
            else {
                bValid = true;
            }
            //alert(cval);
            //if (isNaN(cval)){
            //    bValid = false;
            //} 


            //alert(bValid);
            arguments.IsValid = bValid;
            return;
        }
        
        
    </script>

</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cpBody" runat="Server">
</asp:Content>
